<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单管理</title>
    <link rel="stylesheet" href="/element-ui/lib/theme-chalk/index.css">
    <script src="js/vue@2.7.10.js"></script>
    <script src="/element-ui/lib/index.js"></script>
    <script src="js/axios-0.18.0.js"></script>
</head>
<body>
<div id="app">
    <template>
        <el-table
                :data="orderData"
                border
                style="width: 100%">
            <el-table-column
                    prop="id"
                    label="订单号"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="userId"
                    label="用户ID"
                    width="180">
            </el-table-column>
            <el-table-column
                    prop="totalPrice"
                    label="金额">
            </el-table-column>
            <el-table-column
                    prop="paymentStatus"
                    label="支付状态">
            </el-table-column>
            <el-table-column
                    prop="createdAt"
                    label="下单时间">
            </el-table-column>
        </el-table>
    </template>
</div>
</body>

<script>
    new Vue({
        el: "#app",
        mounted() {
            this.init();
        },
        methods: {
            init() {
                axios.get('/order').then(res => {
                    if (res.data.code === 1) {
                        this.orderData = res.data.data;
                    }
                });
            }
        },
        data: function (){
            return {
                orderData: [],
            }
        }
    })
</script>
</html>